<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .test{
            height: 100px;
            width: 100px;
            background-color: pink;
            transition: 3s 1s;
            /* transition-duration: 3s;
            transition-property: all; //只有具备中间值属性的才具有过渡效果 比如width opacity等等
            transition-timing-function: ease;
            transform-style: 0s; */
        }
        .test:hover{
            width: 500px;
        }
        .test2{ 
            /* 可以同时为多个值设置过渡 */
            transition: width 2s linear 200ms,background 2s linear 200ms;
            height: 100px;
            width: 100px;
            background-color: pink;
        }
        .test2:hover{
            width: 500px;
            background-color: #000;
        }
    </style>
</head>
<body>
    参考这篇文章
    <!-- https://www.cnblogs.com/xiaohuochai/p/5347930.html -->
    <!-- 通过这四个属性完成一个完整的过渡动画效果 -->
    <!-- transition-property: 过渡属性(默认值为all)
    transition-duration: 过渡持续时间(默认值为0s)
    transiton-timing-function: 过渡函数(默认值为ease函数)
    transition-delay: 过渡延迟时间(默认值为0s) -->
    <div class="test2"></div>
    <script>
        let test = document.getElementsByClassName('.test2')[0]
        test.addEventListener("transitionend", myFunction);//过渡动画完成后的回调函数
        function myFunction(e){
            console.log(e);
        }
    </script>
</body>
</html>